/**
 * kl yy-ds @2021
 */
package com.cxps.cloud.code;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;

/**
 * TODO(类描述)
 *
 * @author YouCai.Liu
 * @since 2021/11/28
 * ...
 */
public class ss {

    private static Random r = new Random();
    private static Integer[] red = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 31, 32, 33};
    private static Integer[] blue = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};

    private static int randomRedIndex() {
        return r.nextInt(33);
    }

    private static int randomBlueIndex() {
        return r.nextInt(16);
    }

    private static void red() throws InterruptedException {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < 6; i++) {
            Integer j = red[randomRedIndex()];
            if (list.contains(j)) {
                i--;
                continue;
            }
            Thread.sleep(300);
            list.add(j);
        }
        Collections.sort(list);
        StringBuilder sb = new StringBuilder();
        for (Integer integer : list) {
            sb.append(integer).append(" ");
        }
        System.out.println("红：" + sb.toString());
    }

    private static void blue() {
        System.out.println("蓝：" + blue[randomBlueIndex()]);
    }

    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i < 5; i++) {
            red();
            blue();
            System.out.println();
        }

    }

}
